import request from '@/utils/request'

export function getDepartments() {
  return request({
    url: '/company/department'
  })
}

// 获取部门负责人列表
export function fetchManagerList() {
  return request({
    url: '/sys/user/simple',
    method: 'get'
  })
}

// 新增部门
export function fetchAddDepart(data) {
  return request({
    url: '/company/department',
    method: 'post',
    data: data
  })
}

// 编辑部门 数据回填 获取详情
export function fetchdetail(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'get'
  })
}

// 更新详情
export function fetchUpdateDepart(data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data: data
  })
}

// 删除
export function fetchDelDepart(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'DELETE'
  })
}
